//@ sourceURL=TrainPlanTaskView.js
Ext.ns("TrainPlanTaskView");
TrainPlanTaskView = Ext.extend(Ext.Panel, {
    constructor : function(a) {
        Ext.applyIf(this, a);
        var all=this.initUIComponents();
        TrainPlanTaskView.superclass.constructor.call(this, {
            id : "TrainPlanTaskView",
            title : "培训任务管理",
            region : "center",
            layout : "border",
            border : false,
            iconCls : "menu-position",
            items : [all.yearGridPanel,all.yearGridSearchPanel,all.yearGridTreePanel]
        });
    },
    initUIComponents : function() {
    	var yearGridComponents=new createyeargridview({
            topbar : {
                inputFormName : 'TrainPlanTaskForm',
                topbarAdd:{
                    hidden:false
                },
                topbarDel:{
                    hidden:false
                }
            },
            search : {
                items : [ {
                    style : "margin:5px 5px 5px 5px;",
                    text : "任务名称"
                }, {
                    columnWidth : 0.2,
                    xtype : "textfield",
                    name : "Q_taskName_S_LK",
                    maxLength : 256
                } ]
            },
            grid : {
                title : "培训任务列表",
                rowActions:true,
                listUrl : __ctxPath + "/safecultruetrain/listTrainPlanTask.do",
                removeUrl : __ctxPath + "/safecultruetrain/deleteTrainPlanTask.do",
                fields : [ "id", 'years', 'taskName', "taskTitle", "taskTarget", "taskOutline","taskContent","taskDemand","taskTime","taskBeginDate","taskEndDate","attendeeStaff","makeStaff","approveStaff","taskTeacher","recordStaff"],
                columns : [ {
                    header : "id",
                    dataIndex : "id",
                    hidden : true
                }, {
                    header : "年份",
                    dataIndex : "years",
                    width : 50,
                    sortable : true
                }, {
                    header : "任务名称",
                    dataIndex : "taskName",
                    width : 100
                }, {
                    header : "主题",
                    dataIndex : "taskTitle",
                    width : 70
                }, {
                    header : "培训目标",
                    dataIndex : "taskTarget",
                    width : 70
                }, {
                    header : "培训内容",
                    dataIndex : "taskContent",
                    width : 100
                },{
                	 header : "编制人",
                     dataIndex : "makeStaff",
                     width : 100
                },
                    /*header : "管理",
                    dataIndex : "id",
                    sortable : false,
                    width : 80,
                    renderer : function(j, i, g, m, h) {
                        //var l = g.data.id;
                        var l =j;
                        var k = "";
                        if (l) {
                            if (isGranted("_ConMaterialDel")) {
                                k += '<button title="删除" value=" " class="btn-delete" onclick="ConMaterialsBaseInfoView.remove('
                                        + l + ')"></button>';
                            }
                                                           
                        }
                        return k;
                    }
                } ,*/
                new Ext.grid.Column({
                    header : "评审",
                    dataIndex : "scIdps",
                    sortable : false,
                    scope:this,
                    width :70,
                    renderer : function(value, metadata, record, rowIndex, colIndex) {//metadata jss : String attr : String 
                    	
                    	if(record.data.approveStaff==null){
	                    	var startBtn = '<a href="#" title="整改情况" onclick="javaScript:TrainPlanTaskView.LookOver(\'' + record.json.id  + '\',\'' + record.json.years  + '\');">查看</a>'+ '&nbsp||&nbsp' +'<a href="#" title="整改情况" onclick="javaScript:TrainPlanTaskView.Evaluate(\'' + record.json.id  + '\',\'' + record.json.years  + '\');">进行评审</a>';
	                        return startBtn;
                    	}else{
                    		
                    		return '<a href="#" title="整改情况" onclick="javaScript:TrainPlanTaskView.LookOver(\'' + record.json.id  + '\',\'' + record.json.years  + '\');">查看</a>'+ '&nbsp||&nbsp' +'<a href="#" title="整改情况" onclick="javaScript:TrainPlanTaskView.Evaluate(\'' + record.json.id  + '\',\'' + record.json.years  + '\');">已评审</a>';
                    	}
                    }
                })]
            },
            tree : {
                treeUrl : __ctxPath + "/safecultruetrain/treeLoadTrainPlanTask.do"
            }
            
        });
        return yearGridComponents;
    }
});


		TrainPlanTaskView.Evaluate=	function Evaluate(id,years){
				  new TrainTaskEvalutionForm({
					  id :id,
			          operation : Constant.Operation.EDIT,
			          years : years
				    }).show();
				 
			};
			
			TrainPlanTaskView.LookOver=function LookOver(id,years){
				  new TrainTaskEvalutionForm({
					  id :id,
			        operation : Constant.Operation.VIEW,
			        years : years
				    }).show();
			};